package com.sx.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sx.bean.Organization;
import com.sx.service.OrganizationService;
import com.sx.util.Pagination;

@Controller
@RequestMapping("/org")
public class OrganizationController {

	@Autowired
	private OrganizationService organizationService;
	
	@RequestMapping("/getOrgs")
	@ResponseBody
	public Pagination<Organization> getOrg(int pageNumber,int pageSize){
		Pagination<Organization> page = organizationService.getOrg(pageNumber,pageSize);
		return page;
	}
	
	@RequestMapping("/insert")
	@ResponseBody
	public int insertOrg(Organization org){
		int i = organizationService.insertOrg(org);
		return i;
	}
	
	@RequestMapping("/update")
	@ResponseBody
	public int updateOrg(Organization org){
		int i = organizationService.updateOrg(org);
		return i;
	}
	
	@RequestMapping("/remove")
	@ResponseBody
	public int delete(String id){
		int i = organizationService.deleteOrg(id);
		return i;
	}
}
